package com.xmhmyh.generalframework.project.systool.service;


import com.xmhmyh.generalframework.common.BaseIService;
import com.xmhmyh.generalframework.project.sys.entity.User;
import com.xmhmyh.generalframework.project.systool.dto.QuartzJobDTO;
import com.xmhmyh.generalframework.project.systool.entity.QuartzJob;
import org.quartz.SchedulerException;

import java.util.List;

/**
 * @author zzx
 */
public interface IQuartzJobService extends BaseIService<QuartzJob> {

    void init() throws SchedulerException;

    /**
     * 立即执行一次定时任务
     *
     * @param id 任务id
     * @throws SchedulerException
     */
    void run(Long id) throws SchedulerException;

    /**
     * 删除定时任务
     *
     * @param id 任务id
     */
    void delete(User user,Long id) throws SchedulerException;

    /**
     * 暂停定时任务
     *
     * @param id 任务id
     */
    void pause(Long id) throws SchedulerException;

    /**
     * 恢复任务
     *
     * @param id 任务id
     */
    void resume(Long id) throws SchedulerException;

    /**
     * 通过id找到任务
     *
     * @param id 任务id
     * @return
     */
    QuartzJob selectById(Long id);

    /**
    * @Author: 周哲轩
    * @Description:
    * @DateTime: 2020/8/11 5:47 下午
    * @Params: * @param: user 用户信息 quartzJob 任务信息
    * @Return {@link null}
    */
    void saveHandler(User user, QuartzJobDTO quartzJobDTO);

    Object getAllRunningJob() throws SchedulerException;
}
